<?php
/**
 * Created by PhpStorm.
 * User: zhongbaitong
 * Date: 2020/1/14
 * Time: 10:29
 */

namespace app\forum\model;

class UserFans extends ForumBase
{
    // 用户关系
    // 0-没关系 1-关注ing 2-关注ed 3-互相关注
    public static function relationship ($user_id,$obj_uid){

        $where = [
            "user_id" => $user_id,
            "obj_uid" => $obj_uid
        ];
        $is_focusing = !self::get($where) ? 0 : 1;

        $map = [
            "user_id" => $obj_uid,
            "obj_uid" => $user_id
        ];
        $is_focused = !self::get($map) ? 0 : 2;

        return $is_focusing + $is_focused;

    }
}